<!DOCTYPE HTML>
<html>
    <head>
        <title>Example</title>
        <meta name="author" content="Adam Freeman"/>
        <meta name="description" content="A simple example"/>
    </head>
    <body>
        <p id="cookiedata">
            
        </p>
        <button id="write">Add Cookie</button>
        <button id="update">Update Cookie</button>
        <script>        
    
            var cookieCount = 0;
            document.getElementById("update").onclick = updateCookie;
            document.getElementById("write").onclick = createCookie;
            readCookies();

            function readCookies() {
                document.getElementById("cookiedata").innerHTML = document.cookie;
            }
            
            function createCookie() {
                cookieCount++;
                document.cookie = "Cookie_" + cookieCount + "=Value_" + cookieCount;
                readCookies(); 
            }
            
            function updateCookie() {
                document.cookie = "Cookie_" + cookieCount + "=Updated_" + cookieCount;
                readCookies();                
            }
        </script>
    </body>
</html>
